In [5]:
#Create a series
import pandas as pd
series_1 = pd.Series([1,2,3,4])
In [6]:
# Left column is index and Right column is Data
series_1
Out[6]:
In [7]:
series_1.index
Out[7]:
In [8]:
series_1.values
Out[8]:
In [9]:
series_1[1]
Out[9]:
In [10]:
series_1[1:]
Out[10]:
In [11]:
series_1[:2]
Out[11]:
In [12]:
# Here Index Assign naming to particulr data
series_2 = pd.Series([1,2,3,4], index=['a','b','c','d'])
In [13]:
series_2
Out[13]:
In [14]:
series_2[1]
Out[14]:
In [15]:
series_2['b']
Out[15]:
In [17]:
#Use Python Dictionary as series Series.
# A dictionary is a structure which maps arbitrary keys to a set of arbitrary values, and a series is a structure which
# maps typed keys to a set of typed values.
#Create a Python Dictionary
python_dic = {'Nandan':'Big Data','Kundan':'Manager','Chandan':'Businees Man'}
# Assign Dictionary to Series
people = pd.Series(python_dic)
# Check the Series
people
Out[17]:
In [18]:
#Check type of data object
type(people)
Out[18]:
In [19]:
people['Nandan']
Out[19]:
In [21]:
people[2]
Out[21]:
In [ ]: